package com.ywk.effective._8_transitivity;

import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

public class CountPoint extends Point {
    private static final AtomicInteger counter = new AtomicInteger();

    public CountPoint(int x, int y) {
        super(x, y);
        counter.incrementAndGet();
    }

    public int numberCreated() {
        return counter.get();
    }


static class Main {
    private static Set<Point> unitCircle;

    static {
        unitCircle = new HashSet<>();
        unitCircle.add(new Point(1, 0));
        unitCircle.add(new Point(-1, 1));
        unitCircle.add(new Point(1, 1));
        unitCircle.add(new Point(1, 2));

    }

    public static boolean onUnitCircle(Point point) {
        return unitCircle.contains(point);
    }

    public static void main(String[] args) {
        for (Point point : unitCircle) {
                System.out.println(point.equals(new CountPoint(1, 0)));

        }
        System.out.println(unitCircle.contains(new CountPoint(1, 0)));
        //System.out.println(onUnitCircle(new Point(1, 0)));
    }
}
}
